package adaptive.opencom;

import java.util.ArrayList;
import java.util.List;

import OpenCOM.ILifeCycle;
import OpenCOM.IMetaInterface;
import OpenCOM.IUnknown;
import OpenCOM.OpenCOMComponent;
import adaptive.opencom.log.KeyLog;

/**
 * This component implements a Event Monitor
 * @author sibelius
 *
 */
public class EventMonitorComponent extends OpenCOMComponent
	implements IEventMonitor, IUnknown, ILifeCycle, IMetaInterface {

	private List<KeyLog> mKeyboardLog;
	
	public EventMonitorComponent(IUnknown mpIOCM) {
		super(mpIOCM);
		mKeyboardLog = new ArrayList<KeyLog>();
	}
	
	// ILifeCycle operations
	@Override
	public boolean startup(Object data) {
		return true;
	}

	@Override
	public boolean shutdown() {
		return true;
	}

	// IEventMonitor operations
	@Override
	public void logKey(KeyLog keyLog) {
		//Log.d("Key", String.valueOf((char) keyLog.getKeyCode()));
		mKeyboardLog.add(keyLog);
		
	}

	@Override
	public List<KeyLog> getKeyboardLog() {
		return mKeyboardLog;
	}

}
